#!/usr/bin/env python3

"""
文本处理模块异常定义
"""

class TextProcessingError(Exception):
    """文本处理基础异常类"""
    def __init__(self, message: str, error_code: str = "TEXT_PROCESSING_ERROR"):
        self.message = message
        self.error_code = error_code
        super().__init__(self.message)

class ModelLoadError(TextProcessingError):
    """模型加载异常"""
    def __init__(self, model_name: str, message: str):
        self.model_name = model_name
        super().__init__(f"模型 {model_name} 加载失败: {message}", "MODEL_LOAD_ERROR")

class TextValidationError(TextProcessingError):
    """文本验证异常"""
    def __init__(self, message: str):
        super().__init__(f"文本验证失败: {message}", "TEXT_VALIDATION_ERROR")

class ClassificationError(TextProcessingError):
    """文本分类异常"""
    def __init__(self, message: str):
        super().__init__(f"文本分类失败: {message}", "CLASSIFICATION_ERROR")

class SummaryGenerationError(TextProcessingError):
    """摘要生成异常"""
    def __init__(self, message: str):
        super().__init__(f"摘要生成失败: {message}", "SUMMARY_GENERATION_ERROR")

class ResourceLimitError(TextProcessingError):
    """资源限制异常"""
    def __init__(self, message: str):
        super().__init__(f"资源限制: {message}", "RESOURCE_LIMIT_ERROR")
